﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ywxt.TenderBond
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ywxt.TenderBond;
    public class Map_BZJ_Sub_Account : EntityMapping<BZJ_Sub_Account>
    {
        public Map_BZJ_Sub_Account()
        {
            Property(x => x.BZJAheadView, map => map.Length(10));
            Property(x => x.BZJEndDateTime);
            Property(x => x.BiaoDuanHao, map => map.Length(50));
            Property(x => x.IAcctNo, map => map.Length(50));
            Property(x => x.OpenDateTime);
            Property(x => x.TransDateTime);
            Property(x => x.TransRltMsg, map => map.Length(500));
            Property(x => x.AuthCode, map => map.Length(100));
            Property(x => x.ProjectIsEnd);
            Property(x => x.TransDateTime);
            Property(x => x.TransRltMsg, map => map.Length(500));

            //关联项目
            ManyToOne(x => x.Project, map =>
            {
                map.Column("ProjectId");
            });

            //关联创建操作员
            ManyToOne(x => x.OpUser, map =>
            {
                map.Column("OpUserId");
            });

            //关联结束操作员
            ManyToOne(x => x.EndUser, map =>
            {
                map.Column("EndUserId");
            });

            Property(x => x.EndDate);

            Property(x => x.EndDescribe, map => map.Length(8888800));

            Bag(x => x.TenderBondRecords, map =>
            {
                map.Key(keyMapper => keyMapper.Column("SubAccountId"));
                map.Cascade(Cascade.None);
            }, rel => rel.OneToMany());


        }
    }
}
